home *** CD-ROM | disk | FTP | other *** search
- /* Demo Script */
- guifile = 'test.gui'
-
- options results
- launchvarexx = FALSE
-
- /* Open libs needed */
- if ~show("L","rexxsupport.library") then
- if ~addlib("rexxsupport.library", 0, -30) then exit
-
- if ~show("L","rexxreqtools.library") then
- if ~addlib("rexxreqtools.library", 0, -30) then exit
-
- /* Check Varexx is loaded if not load it */
-
- if show( 'p', 'VAREXX' ) ~= 1 then do
- address command 'run varexx'
- waitforport VAREXX
- launchvarexx = TRUE
- end
- address VAREXX
-
- /* Open the port for gui to talk to */
- call openport("WINDOWPORT")
-
- /* Load the gui file into varexx */
- 'load 'guifile' WINDOWPORT'
-
- /* Set host to the port for this gui file */
- host = result
- address value host
-
- /* Display the window */
- show
- busy set
- call message('Varexx opens Gadtoolsbox Gui files and can set the busy pointer.')
-
- call message('The multiple choice options can be set.')
- setnum one 2
- setnum cycle 2
-
- call message('The sliders and scrollers can be moved.')
- setnum scroll 10
- setnum slider 10
-
- call message('And their other values altered.')
- setbar scroll min 50 max 150
- setbar slider min 0 max 100
-
- call message('Fixed text and number gadget can be filled.')
- settext text 'Amiga'
- setnum noview 4000
-
- call message('as can the editable ones.')
- settext gad1 'You could change this.'
- setnum num 2001
-
- call message('Checking check boxes.')
- setcheck gad2 check
-
- call message('Add items to listviews.')
- 'setlist LIST Haddock Cod Place Skate Herring Tuna'
-
- call message('Opps. You can get rid of them as well')
- 'setlist LIST Place del'
-
- call message('and select them.')
- 'setlist LIST select Cod'
-
- call message('Clear the list and start again.')
- 'setlist LIST clear Monday Tuesday Wednesday Thursday Friday'
-
- call message('Disable gadgets')
- set slider cycle scroll gad1 gad2 num okay list one file pallete disable
-
- call message('and guess what -- Enable them too.')
- set slider cycle scroll gad1 gad2 num okay list one file pallete enable
-
- fish = 'You can also react to the user.' || '0a'x
- fish = fish|| 'Click Onwards and play with the GUI and' || '0A'x
- fish = fish || 'watch the shell. Click Okay to continue.' || '0a'x
- fish = fish || 'Keyboard shortcuts as well.'
-
- call message( fish )
-
- busy
- do forever
- call waitpkt( "WINDOWPORT" )
-
- packet = getpkt( "WINDOWPORT" )
-
-
- if packet ~= '00000000'x then do
- class = getarg(packet)
- type = word( class, 1)
- msg = substr( class, length( type ) + 1 )
-
- select
- when type = closewindow then say 'Clicked on close gadget.'
- when type = okay then leave
- when type = list then say 'List selected 'msg
- when type = cycle then say 'Cycle gadget option 'msg
- when type = one then say 'Multiple Choice gadget option 'msg
- when type = scroll then say 'Scroller now at 'msg
- when type = slider then say 'Slider now at 'msg
- when type = gad1 then say 'You typed in 'msg
- when type = num then say 'Your number is 'msg
- when type = palette then say 'Colour #'msg
- when type = gad2 then say 'Check is 'msg
- when type = file then do
- dict = rtfilerequest(, ,'Select a file' , , 'rt_reqpos = reqpos_centerscr')
- settext gad1 dict
- end
- otherwise say class
- end
-
- end
- end
-
- call message( ' Lets us proceed. Try the Zoom Gadget...' )
- window zip
- fish = 'That was Pos zoom. Varexx supports most' || '0a'x
- fish = fish || 'of the options that can be set in GadToolsBox.' || '0a'x
- fish = fish || 'Varexx adapts to fonts and resolutions.'
- call message( fish )
-
- busy set
-
- call message( 'Your arexx script can read from Varexx Gadgets.')
-
- read one
- fish = 'Multiple Choice option = 'result || '0a'x
- read cycle
- fish = fish || 'Cycle gadget option = 'result || '0a'x
- read slider
- fish = fish || 'Slider at 'result || '0a'x
- read scroll
- fish = fish || 'Scroller at 'result
- call message( fish )
-
- read gad1
- fish = 'You typed : 'result || '0a'x
- read num
- fish = fish || 'Number entered : 'result || '0a'x
- read palette
- fish = fish || 'Palette colour : 'result || '0a'x
- read gad2
- fish = fish || 'Check is 'result
- call message( fish )
-
- read list
- if result = 'RESULT' then do
- call message( 'No item is selected in the list. But you can...')
- end; else; do
- call message( 'For lists the selected item is 'result' or...')
- end
-
- read list var h
- fish = 'List all items...'
- do n = 1 to h.count
- fish = fish || '0a'x || h.n
- end
- drop h
-
- call message( fish )
- 'hide'
- call message( 'Windows can be hidden')
- 'show next'
- call message( 'and if there is more than one in a GUI file.' )
-
- /* Create the context for a new window */
- 'spawn WINDOWPORT'
- vhost2 = RESULT
- address value vhost2
-
- /* Show the second window */
- 'show'
- address
-
- /* Move the other forwards */
- 'window front'
-
- call message( 'Both on screen at once !' )
-
- /* Unload and remove both windows */
- 'hide unload'
- address
- 'hide unload'
-
- call message('That is all. I Hope you liked it.')
-
- call closeport( "WINDOWPORT" )
-
- if launchvarexx = TRUE then address command vxc
-
- exit
-
- message : procedure
- call rtezrequest( arg(1),'Onwards','Varexx (Patronizing) Demo','rt_reqpos = reqpos_topleftscr rtez_flags=ezreqf_centertext',)
- return
-
-
-
-
-